<style type="text/css">
#basemenu{
  width: 1000px;
  height: 33px;
}
#mnavigation1{
  width:1000px;
  height: 25px;
  text-align:left;
}
#mnavigation2{
  width:1000px;
  height: 25px;
  border-bottom:solid 1px #ccc;
  text-align:left;
}
.ntable a{
  font-size: 11px;
}
.ntable{
  height:25px;
  line-height: 25px;
}
.ntable a{
  color: #666;
}
.ntable a:hover{
  text-decoration: underline;
}
#basemenu2{
  width: 1000px;
  line-height: 33px;
}
.mtable{
  width: 1000px;
  height: 33px;
}
.mtable td{
  height: 33px;
}
.mtable td table{
  width: 100%;
  height: 100%;
}
.mtable td:last-child table td{
  background-image: url("templates/ui/default/assets/red_menu.png")!important;
  background-repeat: repeat-x;
}
.menu_mtd,.menu_mtd_h{
  background: url("templates/ui/default/assets/menubackline.png") repeat-x;
  text-align: center;
  font-weight: bold;
  padding: 0 20px;
}
.menu_mtd_h a{color: #1b1b1b;}
#menu_mtd_h a{color: #1b1b1b;}
.menu_mtd a{color: #fff;}
.menu_mtd a:hover{color: #1b1b1b;}
a,a:link,a:visited {
  outline: none;
  text-decoration: none;
}
</style>



<table cellpadding="0" cellspacing="0" class="mtable">
<tr>
{{foreach key=key1 item=item1 from=$mess}}
  {{if $key1 eq 'c'}}
    {{foreach key=key2 item=item2 from=$item1}}
      {{if ($item2->appear_in_menu) eq '1'}}
        <td>
          <table cellpadding="0" cellspacing="0">
            <tr>
              <td style="width:1px;background:url(templates/ui/default/assets/menubackline-l.png) no-repeat;"></td>
              {{if $item2->c|@count eq 0 || $idx == 3}}
                <td {{if ($item2->id) == $idx}}class="menu_mtd_h" {{else}}class="menu_mtd"{{/if}}>
              {{else}}
                <td class="menu_mtd" 
                {{foreach key=key3 item=item3 from=$item2}}
                  {{if $key3 eq 'c'}}
                    {{foreach key=key4 item=item4 from=$item3}}
                      {{if $item4->id == $idx}} id="menu_mtd_h"{{/if}}
                    {{/foreach}}
                  {{/if}}
                {{/foreach}}
              >
              {{/if}}
              <a style="margin:0 5px;" 
                {{if ($item2->type) == 'Common'}} href="?i={{$item2->id}}"
                {{else if ($item2->type) == 'Link to Internal Page'}}href="?i={{$item2->url}}"
                {{else if ($item2->type) == 'Link to Dev Unit'}}href="?t={{$item2->url}}&c=1&i={{$item2->id}}"
                {{else}} href="{{$item2->url}}"
                {{/if}}>{{$item2->name}}</a></td>
              <td style="width:1px;background:url(templates/ui/default/assets/menubackline-r.png) no-repeat;"></td>
            </tr>
          </table>
        </td>
      {{/if}}
    {{/foreach}}
  {{/if}}
{{/foreach}}
</tr>
</table>


{{if $idx == 1 || $idx == 3}}<div id="mnavigation1">{{else}}<div id="mnavigation2">{{/if}}
{{if $idx != 1}}
<table cellpadding="0" cellspacing="0" class="ntable">
<tr>
<td><a href="?i=1">HOME</a></td>
<td style="padding:0 10px;">></td>
{{foreach key=nkey1 item=nitem1 from=$mess}}
  {{if $nkey1 eq 'c'}}
    {{foreach key=nkey2 item=nitem2 from=$nitem1}}
      {{if $nitem2->c|@count eq 0 || $idx == 3 || $idx == 2}}
        {{if ($nitem2->id) == $idx}}
          <td><a href="?i={{$nitem2->id}}">{{$nitem2->name}}</a></td>
        {{/if}}
      {{else}}
        {{foreach key=nkey3 item=nitem3 from=$nitem2}}
          {{if $nkey3 eq 'c'}}
            {{foreach key=nkey4 item=nitem4 from=$nitem3}}
              {{if $nitem4->id == $idx}}
                <td><a href="?i={{$nitem2->id}}">{{$nitem2->name}}</a></td>
                <td style="padding:0 10px;">></td>
                <td><a href="?i={{$nitem4->id}}">{{$nitem4->name}}</a></td>
              {{/if}}
            {{/foreach}}
          {{/if}}
        {{/foreach}}
      {{/if}}
    {{/foreach}}
  {{/if}}
{{/foreach}}
</tr>
</table>
{{/if}}
</div>